import java.io.IOException;
import java.util.Properties;

public class SimpleFactory {
    public  static Weapon getWeapon(){
        try{
            Properties pro=new Properties();
            pro.load(SimpleFactory.class.getClassLoader().getResourceAsStream("beans.properties"));
            String w=(String)pro.get("weapon");
            Weapon weapon=(Weapon) Class.forName(w).newInstance();
            return weapon;
        }catch (IOException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        return null;
    }
}
